package com.qianbei.user.withdrawal;

import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.android.volley.Request;
import com.qianbei.R;
import com.qianbei.common.base.BaseActivity;
import com.qianbei.common.init.SetData;
import com.qianbei.common.net.control.ServerControl;
import com.qianbei.common.net.control.ServerResult;

public class WithDrawalDetailActivity extends BaseActivity {
    private String userID;
    private TextView mTvWdTotal;
    private ListView mLvWdDetail;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_income_detail);

        setTitle("收入明细");
        userID = SetData.getUserID();

        mTvWdTotal = (TextView) findViewById(R.id.tv_wd_total);
        mLvWdDetail = (ListView) findViewById(R.id.lv_wd_detail);

        initGetData();
    }

    private void initGetData() {
        ServerControl sc = new ServerControl(Request.Method.GET, ALIPAY_WDLIST + userID + "?");

        sc.serverListener = new ServerControl.ServerListener() {
            @Override
            public void serverFinish(ServerResult sr) {
                if (sr.isContinue) {
                    WdDetailBean wdDetailBean = JSON.parseObject(sr.bodyData.toString(), WdDetailBean.class);

                    double total = wdDetailBean.getData().getTotal();
                    mTvWdTotal.setText(total + "元");
                    mLvWdDetail.setAdapter(new WdDetailAdapter(mContext, wdDetailBean.getData().getRecord()));
                }
            }
        };

        sc.startVolley();


    }
}
